<%-- 
    Document   : editaFuncionario
    Created on : Nov 13, 2011, 3:18:33 AM
    Author     : Jun
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <body><div id="container"><div id="content">
        <%@include file="topo.jsp" %>
        <%@ page import="br.objetos.*, java.util.*" %>
         <%
            FuncionarioMetodos fm = new FuncionarioMetodos();
            
            if (request.getParameter("id") != null) {
                fm.buscarFuncionarioId(request.getParameter("id"));
        
            }
            if (request.getParameter("insertedFuncionarioSalvo") != null) {
                fm = (FuncionarioMetodos)session.getAttribute("funcionarioSalvo");
        
            }
            fm.buscarCargos();
        %>
        <table border="0" cellspacing="5" cellpadding="5" width="100%">
            <tr>
                <th>
                    <%@include file="abalateral.jsp" %>
                    
                </th>
            </tr><tr>
                <th align="left">
                    <h1>Edição de Funcionario</h1>
                     
                     <form action="editaFuncionarioDo.jsp" method="post">
                        <table border="0" cellspacing="2">
                            <tr>
                                <th align="right">CPF: </th>
                                <th><input type="text" value="<%=fm.getFuncionario().getPessoa().getCpf()%>" name="cpf" size="60"><th/>
                            </tr>                          
                            <tr>
                                <th align="right">Nome: </th>
                                <th><input type="text" value="<%=fm.getFuncionario().getPessoa().getNome()%>" name="nome" size="60"><th/>
                            </tr>
                             <tr>
                                <th align="right">Cargo: </th>
                                
                                <th align="left">
                                     <select name="cargo" >
                                         <option value="<%=fm.getFuncionario().getSalario().getCargo()%>"><%=fm.getFuncionario().getSalario().getCargo()%>
                                        <%
                                        List listaS = new ArrayList();
                                            listaS = fm.getListaSalario();
                                        for (Iterator it = listaS.iterator(); it.hasNext();) {
                                                Salario salario= (Salario) it.next();
                                         %>
                                    <option value="<%=salario.getCargo()%>"><%=salario.getCargo()%>
                                         <% 
                                        }
                                         %>
                                    </select>
                                </th>
                            </tr>
                            <tr>
                                <th align="right">Telefone: </th>
                                <th><input type="text" value="<%=fm.getFuncionario().getPessoa().getTelefone()%>" name="telefone" size="60"><th/>
                            </tr>
                            <tr>
                                <th align="right">Endereço: </th>
                                <th><input type="text" value="<%=fm.getFuncionario().getPessoa().getEndereco()%>" name="endereco" size="60"><th/>
                            </tr>
                            <tr>
                                <th align="right">Email: </th>
                                <th><input type="text" value="<%=fm.getFuncionario().getPessoa().getEmail()%>" name="email" size="60"><th/>
                            </tr>
                            <tr>
                                <th></th>
                                <%
                                    session.setAttribute("id", fm.getFuncionario().getPessoa().getIdPessoa());
                                %>
                                
                                <th><input type="submit" value="Salvar" /></th>
                            </tr>
                    </form>
                </th>
            </tr>
        </table>
            
    </div><div id="footer" align="center"><%@include file="footer.jsp" %></div></div></body>
</html>
